home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.xml;
-
- import com.extensibility.util.Debug;
- import com.extensibility.util.StringUtilities;
- import java.util.Vector;
-
- public abstract class EntityDeclaration extends BaseDeclaration implements Cloneable {
- String publicID;
- URI systemID;
- String value;
-
- public EntityDeclaration(String var1, String var2, URI var3) {
- super(var1);
- this.publicID = var2;
- this.systemID = var3;
- }
-
- public EntityDeclaration(String var1, String var2) {
- super(var1);
- this.value = var2;
- }
-
- public Object clone() {
- EntityDeclaration var1 = null;
-
- try {
- var1 = (EntityDeclaration)super.clone();
- } catch (CloneNotSupportedException var3) {
- Debug.assert(false, "Problem cloning EntityDeclaration.");
- }
-
- return var1;
- }
-
- public String getPublicID() {
- return this.publicID;
- }
-
- public URI getSystemID() {
- return this.systemID;
- }
-
- public Vector getPrerequisites(SchemaIntf var1) {
- Vector var2 = super.getPrerequisites(var1);
- BaseDeclaration.addPrerequisite(var1, var2, this.value, true);
- BaseDeclaration.addPrerequisite(var1, var2, this.value, false);
- BaseDeclaration.addPrerequisite(var1, var2, this.publicID, true);
- BaseDeclaration.addPrerequisite(var1, var2, this.systemID == null ? null : this.systemID.toSource(), true);
- return var2;
- }
-
- public boolean references(InternalPEDeclaration var1) {
- String var2 = String.valueOf("%").concat(String.valueOf(var1));
- if (this.value != null && this.value.indexOf(var2) >= 0) {
- return true;
- } else if (this.publicID != null && this.publicID.indexOf(var2) >= 0) {
- return true;
- } else {
- return this.systemID != null && this.systemID.toSource().indexOf(var2) >= 0;
- }
- }
-
- public void setPublicID(String var1) {
- String var2 = this.publicID;
- this.publicID = var1;
- this.value = null;
- ((BaseDeclaration)this).fireChangeEvent(53, var2);
- }
-
- public void setSystemID(URI var1) {
- Debug.assert(var1 != null, "sys must be non-null for entities");
- URI var2 = this.systemID;
- this.systemID = var1;
- this.value = null;
- ((BaseDeclaration)this).fireChangeEvent(52, var2);
- }
-
- public String getValue() {
- return this.value;
- }
-
- public void checkForErrors(SchemaIntf var1) {
- super.checkForErrors(var1);
- if (this.publicID != null && !DTDParser.isPubId(this.publicID)) {
- super.errors.addElement(new ParserException(221, this.publicID));
- }
-
- }
-
- public void setValue(String var1) {
- String var2 = this.value;
- this.value = var1;
- this.systemID = null;
- this.publicID = null;
- ((BaseDeclaration)this).fireChangeEvent(51, var2);
- }
-
- public boolean isInternal() {
- return this.value != null;
- }
-
- public boolean isPE() {
- return false;
- }
-
- public String getSource() {
- StringBuffer var1 = new StringBuffer(String.valueOf(String.valueOf(String.valueOf("<!ENTITY ").concat(String.valueOf(this.isPE() ? "% " : ""))).concat(String.valueOf(super.name))).concat(String.valueOf(" ")));
- if (this.value != null) {
- var1.append(DTDUtilities.convertPEReferences(StringUtilities.doubleQuoted(this.value), true));
- } else if (this.publicID != null) {
- var1.append(String.valueOf(String.valueOf(String.valueOf("PUBLIC ").concat(String.valueOf(DTDUtilities.convertPEReferences(StringUtilities.doubleQuoted(this.publicID), true)))).concat(String.valueOf(" "))).concat(String.valueOf(DTDUtilities.convertPEReferences(StringUtilities.doubleQuoted(this.systemID.toSource()), true))));
- } else {
- var1.append(String.valueOf("SYSTEM ").concat(String.valueOf(DTDUtilities.convertPEReferences(StringUtilities.doubleQuoted(this.systemID.toSource()), true))));
- }
-
- var1.append(String.valueOf(">").concat(String.valueOf(BaseDeclaration.LINE_SEPARATOR)));
- return var1.toString();
- }
- }
-